package com.cldz.controller;

import com.cldz.common.dto.res.FsuDataResDto;
import com.cldz.feign.FsuDataFeign;
import com.cldz.service.FsuDataService;
import com.cldz.response.support.ServerResponse;
import com.cldz.common.dto.req.FsuDataDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Author     ：lixiao.
 * @ Date       ：Created in 9:10 2018/12/22
 * @ Description：
 * @ Modified By：
 */
@Slf4j
@RestController
public class FsuDataController implements FsuDataFeign {

    @Autowired
    private FsuDataService fsuDataService;

    /**
     * 获取设备历史数据(FSU)
     * @return
     */
    @GetMapping("/fsuDeviceHisData")
    public ServerResponse getFsuDeviceHisData(FsuDataDto fsuDataDto){

        List<FsuDataResDto> fsuDeviceHisData = fsuDataService.getFsuDeviceHisData(fsuDataDto);
        Integer fsuDeviceHisDataAmount = fsuDataService.getFsuDeviceHisDataAmount(fsuDataDto);

        return ServerResponse.createDataAndCount(fsuDeviceHisDataAmount,fsuDeviceHisData);
    }

    /**
     * 获取设备实时数据(FSU)
     * @param fsuDataDto
     * @return
     */
    @GetMapping("/fsuDeviceRealData")
    public ServerResponse getFsuDeviceRealData(FsuDataDto fsuDataDto){
        List<FsuDataResDto> fsuDeviceRealData = fsuDataService.getFsuDeviceRealData(fsuDataDto);
        Integer fsuDeviceRealDataAmount = fsuDataService.getFsuDeviceRealDataAmount(fsuDataDto);
        return ServerResponse.createDataAndCount(fsuDeviceRealDataAmount,fsuDeviceRealData);
    }


}
